<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Login
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">


<form id="reminderForm" action="/Login/SendReminder" method="post">
<table cellpadding="10" cellspacing="0" border="1" style="border-color:#fff">
    <tr>
        <td colspan="2">
        
            
            
            Enter either a username or the email address you signed up with.
            <br /><br />
            Go back to <a href="/login">Login</a>  or <a href="/signup">Sign Up</a>
        
        </td>
    </tr>
</table>
<table cellpadding="10" cellspacing="10" border="1" style="border-color:#fff">
    <tr>
        <td>Username
        </td>
        <td align="left"><input class="input" type="text" name="username" />
        </td>
    </tr>
    <tr>
        <td>Or</td>
    </tr>
    <tr>
        <td>Email
        </td>
        <td><input class="input" type="text" name="email" />
        </td>
    </tr>
    <tr>
        <td><input type="submit" class="button" value="Send reminder" />
        </td>
        <td>
        </td>
    </tr>
     
</table>
<table>
    <tr>
            <td colspan="2">
                <div id="error"></div>
            </td>
        </tr>  
</table>
</form><br />
<div id="results"></div>


<script type="text/javascript">

$(document).ready(function () {

	var options = { dataType:'json',success:ReminderCallBack,beforeSubmit:Validate }; 
    $('#reminderForm').ajaxForm(options);
    $("input").focus(function () {$(this).css('border-color','#eecc00');$("#error").html("")});
    $("input").blur(function () {$(this).css('border-color','#999');});


      
});
function ReminderCallBack(data)
{
    
   if(data.Successful)
   {
        $("#error").css("color","#fff");
         $("#error").html("Password reminder sent.");
         return true;
   }
   else{
        $("#error").html("Oops, something went wrong. Please try again. <br/>" + data.Exception);
   }

}
function Validate()
{
    if(document.getElementById("reminderForm").username.value != "" || document.getElementById("reminderForm").email.value != "")
    {
        return true
    } 
    $("#error").html("Please enter a username or an email address.");
    return false;
}



</script>

</asp:Content>


